<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>私海规则详情页</title>
    <jsp:include page="../../import.jsp" flush="true" />

</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="formSet1">
        <div class="fieldset1 tabel_col clearFix">
            <div class="fieldBox col_50">
                <div class="label">私海名称</div>
                <div class="field">
                    <span id="privateSeaNm" name="privateSeaNm"></span>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_33">
                <div class="label">所属事业部</div>
                <div class="field">
                    <span id="buOrgCdNm" name="buOrgCdNm"></span>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">是否支持私海领取</div>
                <div class="field">
                    <input id="isCanReceive_yes" type="radio" name="checkChange" <c:if test="${not empty splPriSeaRuleCfgVO.isCanReceive and splPriSeaRuleCfgVO.isCanReceive == 1 }"> checked readonly</c:if>>
                    <span>是</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <input id="isCanReceive_no" type="radio" name="checkChange" <c:if test="${not empty splPriSeaRuleCfgVO.isCanReceive and splPriSeaRuleCfgVO.isCanReceive == 0 }"> checked readonly</c:if> >
                    <span>否</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">私海领取上限</div>
                <div class="field">
                    <span id="receiveLimitUp" name="receiveLimitUp"></span>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">私海客户数限制</div>
                <div class="field">
                    <span id="customersLimitUp" name="customersLimitUp"></span>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox col_50">
                <div class="label">领取私海默认天数</div>
                <div class="field">
                    <span id="receiveDefaultDay" name="receiveDefaultDay"></span>
                    <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="sqPanel">
                <div class="fieldset1 tabel_col clearFix">
                    <div class="sqPanel_head inL">
                        <span>私海领取与释放</span>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">私海释放</div>
                            <div class="field">
                                <div class="allCheckBox">
                                    <input id="receivelimit" type="checkbox" name="checkChange"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.releasedReceiveDay and splPriSeaRuleCfgVO.releasedReceiveDay != -1}"> checked </c:if> readonly="readonly">
                                    <span>释放到公海的经销商，原私海客户经理</span>
                                    <span id="releasedReceiveDay" name="releasedReceiveDay"></span>
                                    <c:if test="${empty splPriSeaRuleCfgVO.releasedReceiveDay or splPriSeaRuleCfgVO.releasedReceiveDay == -1}">
                                        <input id="releasedReceiveDay" type="text" name="releasedReceiveDay" value=""
                                               readonly="readonly">
                                    </c:if>
                                    <span>天内不允许认领</span><br/>
                                    <input id="manulrelease" type="checkbox" name="checkChange"
                                            <c:if test="${not empty splPriSeaRuleCfgVO.isActiveRelease and splPriSeaRuleCfgVO.isActiveRelease == 1}"> checked </c:if> readonly="readonly"">
                                    <span>手动释放</span><br>
                                    <input id="autorelease" type="checkbox" name="checkChange"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.isAutoRelease and splPriSeaRuleCfgVO.isAutoRelease == 1}"> checked </c:if> readonly="readonly">
                                    <span>自动释放</span>
                                    <c:if test="${not empty splPriSeaRuleCfgVO.isAutoRelease and splPriSeaRuleCfgVO.isAutoRelease == 1}">
                                        <div id="auto" style="text-indent: 2em">
                                            <ul>
                                                <li style="text-indent: 2em;">
                                                    <span>自动释放条件关系且/或：</span>
                                                    <input id="qc_yes" type="radio" name="qcChange"
                                                            <c:if test="${not empty splPriSeaRuleCfgVO.autoRuleQCAndIsOr and splPriSeaRuleCfgVO.autoRuleQCAndIsOr == 1}"> checked readonly="readonly" </c:if> />
                                                    <span>且</span>&nbsp;&nbsp;
                                                    <input id="qc_no" type="radio" name="qcChange"
                                                            <c:if test="${not empty splPriSeaRuleCfgVO.autoRuleQCAndIsOr and splPriSeaRuleCfgVO.autoRuleQCAndIsOr == 0}"> checked readonly="readonly" </c:if> />
                                                    <span>或</span>&nbsp;&nbsp;
                                                    <span class="requiredSymbol">*</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_1" type="checkbox" name="checkChange"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.unvisitReleaseDay and splPriSeaRuleCfgVO.unvisitReleaseDay != -1}"> checked </c:if> readonly="readonly">
                                                    <span>从认领日起，</span>
                                                    <span id="unvisitReleaseDay" name="unvisitReleaseDay"></span>
                                                    <c:if test="${empty splPriSeaRuleCfgVO.unvisitReleaseDay or splPriSeaRuleCfgVO.unvisitReleaseDay == -1}">
                                                        <input id="unvisitReleaseDay" type="text" name="unvisitReleaseDay" value=""
                                                               readonly="readonly">
                                                    </c:if>
                                                    <span>个自然日未上门拜访的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_4" type="checkbox" name="checkChange"
                                                        <c:if test="${not empty splPriSeaRuleCfgVO.uncrtprjReleaseDay and splPriSeaRuleCfgVO.uncrtprjReleaseDay != -1}"> checked </c:if> readonly="readonly">
                                                    <span>从认领日起，</span>
                                                    <span id="uncrtprjReleaseDay" name="uncrtprjReleaseDay"></span>
                                                    <c:if test="${empty splPriSeaRuleCfgVO.uncrtprjReleaseDay or splPriSeaRuleCfgVO.uncrtprjReleaseDay == -1}">
                                                        <input id="uncrtprjReleaseDay" type="text" name="uncrtprjReleaseDay" value=""
                                                               readonly="readonly">
                                                    </c:if>
                                                    <span>个自然日未立项的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_2" type="checkbox" name="checkChange"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.uncapReleaseDay and splPriSeaRuleCfgVO.uncapReleaseDay != -1}"> checked </c:if> readonly="readonly">
                                                    <span>认领期间，</span>
                                                    <span id="uncapReleaseDay" name="uncapReleaseDay"></span>
                                                    <c:if test="${empty splPriSeaRuleCfgVO.uncapReleaseDay or splPriSeaRuleCfgVO.uncapReleaseDay == -1}">
                                                        <input id="uncapReleaseDay" type="text" name="uncapReleaseDay" value=""
                                                               readonly="readonly">
                                                    </c:if>
                                                    <span>个自然日未产生放款的，作释放公海处理</span>
                                                </li>
                                                <li>
                                                    <input id="releaseRule_3" type="checkbox" name="checkChange"
                                                    <c:if test="${not empty splPriSeaRuleCfgVO.hadCapedReleaseDay and splPriSeaRuleCfgVO.hadCapedReleaseDay != -1}"> checked </c:if> readonly="readonly">
                                                    <span>认领期间产生放款后，从放款之日起，</span>
                                                    <span id="hadCapedReleaseDay" name="hadCapedReleaseDay"></span>
                                                    <c:if test="${empty splPriSeaRuleCfgVO.hadCapedReleaseDay or splPriSeaRuleCfgVO.hadCapedReleaseDay == -1}">
                                                        <input id="hadCapedReleaseDay" type="text" name="hadCapedReleaseDay" value=""
                                                               readonly="readonly">
                                                    </c:if>
                                                    <span>个自然日未再次产生放款的，作释放公海处理</span>
                                                </li>
                                            </ul>
                                        </div>
                                    </c:if>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">私海领取</div>
                            <div class="field">
                                <div class="allCheckBox">
                                    <input id="receiveRule_1" type="checkbox" name="checkChange"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.capDelayDate and splPriSeaRuleCfgVO.capDelayDate != -1}"> checked </c:if> readonly="readonly">
                                    <span>在私海期间，针对该客户经理有放款记录的将增加私海时长</span>
                                    <span id="capDelayDate" name="capDelayDate"></span>
                                    <c:if test="${empty splPriSeaRuleCfgVO.capDelayDate or splPriSeaRuleCfgVO.capDelayDate == -1}">
                                        <input id="capDelayDate" type="text" name="capDelayDate" value=""
                                               readonly="readonly">
                                    </c:if>
                                    <span>天</span><br/>
                                    <input id="receiveRule_2" type="checkbox" name="checkChange"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.crtPrjDelayDate and splPriSeaRuleCfgVO.crtPrjDelayDate != -1}"> checked </c:if> readonly="readonly">
                                    <span>在私海期间，针对该客户经理有立项记录的将增加私海时长</span>
                                    <span id="crtPrjDelayDate" name="crtPrjDelayDate"></span>
                                    <c:if test="${empty splPriSeaRuleCfgVO.crtPrjDelayDate or splPriSeaRuleCfgVO.crtPrjDelayDate == -1}">
                                        <input id="crtPrjDelayDate" type="text" name="crtPrjDelayDate" value=""
                                               readonly="readonly">
                                    </c:if>
                                    <span>天</span><br/>
                                    <input id="receiveRule_3" type="checkbox" name="checkChange"
                                    <c:if test="${not empty splPriSeaRuleCfgVO.visitRecDelayDate and splPriSeaRuleCfgVO.visitRecDelayDate != -1}"> checked </c:if> readonly="readonly">
                                    <span>在私海期间，针对该客户经理有拜访的将增加私海时长</span>
                                    <span id="visitRecDelayDate" name="visitRecDelayDate"></span>
                                    <c:if test="${empty splPriSeaRuleCfgVO.visitRecDelayDate or splPriSeaRuleCfgVO.visitRecDelayDate == -1}">
                                        <input id="visitRecDelayDate" type="text" name="visitRecDelayDate" value=""
                                               readonly="readonly">
                                    </c:if>
                                    <span>天</span><br/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="sqPanel_body">
                        <div class="fieldBox col_100">
                            <div class="label">备注说明</div>
                            <div class="field">
                                <span id="remark" name="remark"></span>
                                <input name="priSeaId" id="priSeaId" type="hidden" value="${splPriSeaRuleCfgVO.id }">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>


<script type="text/javascript">

    $(function(){
        initData();
    });

    function initData(){
        var id = $("#priSeaId").val();
        if(!id)return;
        var _url = '<%=path%>/spl/splprisearulecfg/getById.do';
        $.ajax({
            type: 'get',
            dataType:'json',
            data:{id:id},
            url: _url,
            success:function(msg){
                if(msg.success == 1){
                    setData(msg.data);//设置数据
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //设置页面数据
    function setData(data){
        var form = liger.get("formSet1");
        $("#privateSeaNm").html(data.privateSeaNm);
        $("#buOrgCdNm").html(data.buOrgCdNm);
        //$("#receiveLimitUp").html(data.receiveLimitUp);
        $("#remark").html(data.remark);

        //$("#releasedReceiveDay").html(data.releasedReceiveDay);
        /*if(data.isAutoRelease && data.isAutoRelease == 1){
            $("#unvisitReleaseDay").html(data.unvisitReleaseDay);
            $("#uncapReleaseDay").html(data.uncapReleaseDay);
            $("#capReleaseDay").html(data.capReleaseDay);
        }*/
        //$("#capDelayDate").html(data.capDelayDate);
        //$("#crtPrjDelayDate").html(data.crtPrjDelayDate);
        if(data.customersLimitUp && data.customersLimitUp != -1){
            $("#customersLimitUp").html(data.customersLimitUp);
        }
        if(data.receiveDefaultDay && data.receiveDefaultDay != -1){
            $("#receiveDefaultDay").html(data.receiveDefaultDay);
        }
        if(data.releasedReceiveDay && data.releasedReceiveDay != -1){
            $("#releasedReceiveDay").html(data.releasedReceiveDay);
        }
        if(data.isAutoRelease && data.isAutoRelease == 1){
            if(data.unvisitReleaseDay && data.unvisitReleaseDay != -1){
                $("#unvisitReleaseDay").html(data.unvisitReleaseDay);
            }
            if(data.uncapReleaseDay && data.uncapReleaseDay != -1){
                $("#uncapReleaseDay").html(data.uncapReleaseDay);
            }
            if(data.hadCapedReleaseDay && data.hadCapedReleaseDay != -1){
                $("#hadCapedReleaseDay").html(data.hadCapedReleaseDay);
            }
            if(data.uncrtprjReleaseDay && data.uncrtprjReleaseDay != -1){
                $("#uncrtprjReleaseDay").html(data.uncrtprjReleaseDay);
            }
            // $("#unvisitReleaseDay").html(data.unvisitReleaseDay);
            // $("#uncapReleaseDay").html(data.uncapReleaseDay);
            // $("#capReleaseDay").html(data.capReleaseDay);
        }
        if(data.capDelayDate && data.capDelayDate != -1){
            $("#capDelayDate").html(data.capDelayDate);
        }
        if(data.crtPrjDelayDate && data.crtPrjDelayDate != -1){
            $("#crtPrjDelayDate").html(data.crtPrjDelayDate);
        }
        if(data.visitRecDelayDate && data.visitRecDelayDate != -1){
            $("#visitRecDelayDate").html(data.visitRecDelayDate);
        }
        if(data.receiveLimitUp && data.receiveLimitUp != -1){
            $("#receiveLimitUp").html(data.receiveLimitUp);
        }

    };

    //定义父级调用事件
    frameElement.dialog.onOk = function () {
        //save();
    }

    frameElement.dialog.onCancel = function () {
        frameElement.dialog.close();
    }


</script>



</body>
</html>
